import mongoose from 'mongoose'
import validator from 'validator'


const employeeSchema = new mongoose.Schema({
  firstName: {
    type: String,
    required: true
  },
  lastName: {
    type: String,
    required: true
  },
  middleName: {
    type: String,
    required: false
  },
  comment: {
    type: String,
    required: false
  },
  email: {
    type: String,
    required: false,
    validate: {
      validator: validator.isEmail,
    },
  },
  phone: {
    type: String,
    required: false
  },
  telegram: {
    type: String,
    required: false
  },
  birthDay: {
    type: Date,
    required: true,
  },
  isActive: {
    type: Boolean,
    required: true,
  },
  config: {
    type: Object,
    required: true,
  },
  sex: {
    type: String,
    required: false
  },
  grade: {
    type: String,
    required: false
  },
  photo: {
    type: String,
    required: false
  }
})

export default mongoose.model('employee', employeeSchema)
